using System;
using Coderoom.ScrumPlanner.Data.Contracts;
using Coderoom.ScrumPlanner.Domain;
using Coderoom.ScrumPlanner.Resources;

namespace Coderoom.ScrumPlanner.Data
{
	public sealed class ThemeService : Service<IThemeRepository>
	{
		public ThemeService(IThemeRepository repository) : base(repository) {}

		public ThemeCollection GetThemes(Guid projectId)
		{
			return Repository.GetThemes(projectId);
		}

		public Theme GetTheme(Guid themeId)
		{
			return Repository.GetTheme(themeId);
		}

		public void CreateTheme(Theme theme)
		{
			if (theme == null)
				throw new ArgumentNullException("theme");

			if (string.IsNullOrEmpty(theme.Title))
				throw new ArgumentException(ExceptionMessages.ArgumentException_ThemeTitleIsNullOrEmpty);

			Repository.CreateTheme(theme);
		}

		public bool DeleteTheme(Guid themeId)
		{
			return Repository.DeleteTheme(themeId);
		}
	}
}